/*
 * Created on Oct 15, 2004
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
package com.erclab.internal.xpresso.formelements;

import com.erclab.internal.xpresso.forms.Form;
import com.erclab.internal.xpresso.webapp.HTMLHelper;

/**
 * @author rodrigen
 *
 * To change the template for this generated type comment go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
public class DateBox extends SimpleInputBox {

	/* (non-Javadoc)
	 * @see com.erclab.internal.xpresso.forms.FormElement#toHTML()
	 */
	public String toHTML(Form theForm) {
		
		if (theForm.getFormParameters().getAction().equals("update")){
			if(originalValue != null){
				return HTMLHelper.getCalendarBox("Field" + idFormElement, 
													this.destinationColumn,
													originalValue,
													"Form" + theForm.getIdForm()); 
			}
		} else {
			if(lookupValue != null){
				return HTMLHelper.getCalendarBox("Field" + idFormElement, 
									this.destinationColumn,
									originalValue,
									"Form" + theForm.getIdForm()); 
			}
		}
				
		return HTMLHelper.getCalendarBox("Field" + idFormElement, 
										this.destinationColumn,
										null,
										"Form" + theForm.getIdForm());
	}
	

}
